package com.bestcem.xm.ticket.controller.param.ticket.config.createParam;

import com.bestcem.xm.ticket.entity.mongo.NotifySetting;
import lombok.Data;

import javax.annotation.Nullable;

/**
 * @author zq.ding <zq.ding@idiaoyan.com>
 * @version v1.0
 * @date 2021/9/8 16:57
 */
@Data
public class WayParam {
    private boolean email;
    private boolean sms;
    private boolean feishu;
    private boolean wechatwork;
    private boolean dingtalk;

    @Nullable
    public static NotifySetting.Way paramToEntity(WayParam param) {
        if (param == null) {
            return null;
        }
        NotifySetting.Way way = new NotifySetting.Way();
        way.setEmail(param.isEmail());
        way.setSms(param.isSms());
        way.setFeiShu(param.isFeishu());
        way.setWeChatWork(param.isWechatwork());
        way.setDingtalk(param.isDingtalk());
        return way;
    }
}
